package com.zeropoint.demo.pojo;


import lombok.ToString;

/**
 * 自然资源指标标准化
 */
@ToString
public class NaturalResourceStandardized {

    //数据汇总
    //总人口
    public int totalPopulation;
    //家庭现有宅基地数
    public int homesteads;
    //家庭现有耕地数
    public double cultivatedLand;
    //家庭现有林地数
    public double forestLand;
    //该县（区）人均耕地面积
    public double cultivatedPer;
    //该县（区）人均林地面积
    public double forestPer;

    //数据整理
    //人均现有耕地面积
    public double currentCultivatedLandPer;
    //人均现有林地面积
    public double currentForestLandPer;

    //计算结果
    //家庭现有宅基地数赋值
    public double homesteadsAssignment;
    //家庭现有耕地面积赋值
    public double cultivatedAssignment;
    //家庭现有林地面积赋值
    public double forestAssignment;

    public NaturalResourceStandardized(Questionnaire_info info, FormTwo formTwo){
           totalPopulation = HumanResourceStandardized.totalPopulation;
           if("无".equals(formTwo.house_site_number)){
               homesteads = 0;
               homesteadsAssignment = 0;
           }else if("1块".equals(formTwo.house_site_number)){
               homesteads = 1;
               homesteadsAssignment = 0.8;
           }else if("2块".equals(formTwo.house_site_number)){
               homesteads = 2;
               homesteadsAssignment = 1;
           }else{
               homesteads = 3;
               homesteadsAssignment = 1;
           }

          cultivatedLand = formTwo.have_arable_land;
          forestLand = formTwo.woodland_area;

          //该县（区）人均耕地面积
          cultivatedPer = info.cultivatedPer;
          //该县（区）人均林地面积
          forestPer = info.forestPer;

          currentCultivatedLandPer = cultivatedLand/totalPopulation;

          currentForestLandPer = forestLand/totalPopulation;

          if (currentCultivatedLandPer >= cultivatedPer)
              cultivatedAssignment = 1;
          else
              cultivatedAssignment = currentCultivatedLandPer/cultivatedPer;

          if(currentForestLandPer >= forestPer)
              forestAssignment = 1;
          else
              forestAssignment = currentForestLandPer/forestPer;
    }



    public static void main(String[] args) {
        HumanResourceStandardized.totalPopulation = 3;
        Questionnaire_info info = new Questionnaire_info();
        info.cultivatedPer = 1.485849057;
        info.forestPer = 0.387612797;
        FormTwo two = new FormTwo();

        //宅基地数量
        two.house_site_number = "1块";
        //自有耕地面积
        two.have_arable_land = 5;
        //流转耕地面积
        two.roam_arable_land = 5;
        //现有林地面积
        two.woodland_area = 0.9;

        System.out.println(new NaturalResourceStandardized(info, two));
    }
}
